<template>
  <uni-popup ref="popup" type="dialog" @change="change">
    <uni-popup-dialog v-model="name" mode="input" :title="title" placeholder="请输入内容" @confirm="dialogInputConfirm"></uni-popup-dialog>
  </uni-popup>
</template>

<script>
import uniPopup from "@/components/uni-popup/uni-popup.vue";
import uniPopupDialog from "@/components/uni-popup/uni-popup-dialog.vue";
export default {
  components: { uniPopup, uniPopupDialog },
  props: {
    title: {
      type: String,
      default: () => "输入属性选项"
    }
  },
  data() {
    return {
      name: ""
    };
  },
  methods: {
    open() {
      this.$refs.popup.open();
    },
    close() {
      this.$refs.popup.close();
    },
    dialogInputConfirm(e, name) {
      if (name) {
        this.$emit("submit", name);
        e();
      } else {
        uni.showToast({
          icon: "none",
          title: this.title
        });
      }
    },
    change(e) {
      // console.log("change", this.name, e);
    }
  }
};
</script>

<style scoped lang="scss">
.prop-dialog {
}
</style>
